/*
* Copyright (C) 2019 ~ 2021 Uniontech Software Technology Co.,Ltd.
*
* Author:     yanghongwei <yanghongwei@uniontech.com>
*
* Maintainer: yanghongwei <yanghongwei@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef DEVICE_H
#define DEVICE_H

#include <Poco/DateTime.h>

#include <string>
#include <vector>

#include <nlohmann/json.hpp>

struct Device
{
    uint32_t    device_id;
    std::string device_code;
    std::string device_name;
    int8_t      device_type;
    std::string encryption_key;
    int32_t     person_id;
    int32_t     is_enable;
    std::string description;
    std::string remark;
    std::string expire;
    std::string address;
    std::string link_man;
    std::string link_mobile;
    std::string link_address;
    std::string manager;
    std::string iccid;
    Poco::DateTime create_time;
    Poco::DateTime update_time;
};

void printf(const Device &device);
nlohmann::json DeviceToJson(const Device &device);

class DeviceManager
{
public:
    DeviceManager() = default;

    Device getDeviceByDeviceCode(std::string deviceCode);
    std::vector<Device> getAllDevice();
};

#endif
